home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / Anwendun / LUNA152A / _ENGLISH / MODULES / SPECIMEN.S < prev    next >
Encoding:
Text File  |  1999-09-18  |  3.3 KB  |  105 lines

  1.  
  2. ; Specimen (block-)filter module (*.FM)
  3. ; (c)1999 Richard Gordon Faika
  4.  
  5. ; --------------------------------------------------------------------
  6. ; Get parameters
  7. ; Here the required parameters are fetched from the stack.
  8. ; --------------------------------------------------------------------
  9.  
  10.          move  4(sp),d0       ; Get function number
  11.          move.l   6(sp),a1    ; Get string start address
  12.          move  14(sp),d1      ; Get string length
  13.  
  14.          tst      d0          ; Filter?
  15.          beq      filter
  16.  
  17.  
  18.  
  19.  
  20. ; --------------------------------------------------------------------
  21. ; Evaluate function number
  22. ; --------------------------------------------------------------------
  23.  
  24.          cmpi  #1,d0
  25.          bne      case1 
  26.          bra      GetInfo     ; Info
  27. case1:   cmpi  #2,d0
  28.          bne      case2 
  29.          bra      ModInit     ; Init
  30. case2:   cmpi  #3,d0
  31.          bne      noFunc
  32.          bra      ModExit     ; Exit
  33.  
  34.  
  35. ; --------------------------------------------------------------------
  36. ; Module initialisation
  37. ; --------------------------------------------------------------------
  38. ModInit: clr.l d0
  39.          rts
  40.  
  41.  
  42.  
  43. ; --------------------------------------------------------------------
  44. ; Module deinitialisation
  45. ; --------------------------------------------------------------------
  46. ModExit: clr.l d0
  47.          rts
  48.  
  49.  
  50.  
  51. ; --------------------------------------------------------------------
  52. ; Return info-text pointer
  53. ; The info-text will be displayed in the module's info-dialog by Luna, 
  54. ; when the user requests module information for this module.
  55. ; --------------------------------------------------------------------
  56. GetInfo: lea.l info(pc),a0    ; Returns a pointer to the info-text
  57.          move.l   a0,d0
  58.          rts
  59.  
  60.  
  61.  
  62.  
  63.  
  64. ; --------------------------------------------------------------------
  65. ; Unknown function number
  66. ; --------------------------------------------------------------------
  67. noFunc:  moveq.l  #-32,d0
  68.          rts
  69.  
  70.  
  71.  
  72.  
  73. ; --------------------------------------------------------------------
  74. ; Filter routine
  75. ; The actual filtering routine, with which one can alter the text.
  76. ; For text length changes or similar, one should write to the working
  77. ; buffer and return a 1. 
  78. ; --------------------------------------------------------------------
  79. filter:  tst      d1
  80.          beq      exit
  81.          bra      goin
  82.    loop:    
  83.          move.b   (a1),d0
  84.          rol.b #4,d0       ; Stupid, but effective =:)
  85.          move.b   d0,(a1)+
  86.    goin: 
  87.          dbra  d1,loop
  88. exit:    clr.l d0          ; 0 = OK
  89.          rts
  90.  
  91.  
  92.  
  93. ; --------------------------------------------------------------------
  94. ; Info-text
  95. ; The info-text has to follow this structure, because 6 strings are always
  96. ; read one after the other. So the minimum is a nullbyte per entry.
  97. ; --------------------------------------------------------------------
  98. info:    dc.b  ' Specimen module',0  ; Module info for popup, max. 24 chars.+nullbyte
  99.          dc.b  'Author's name',0     ; Author's name, max. 20 chars.+nullbyte
  100.          dc.b  'Info-text line 1',0  ; Max. 40 characters+nullbyte
  101.          dc.b  'Info-text line 2',0  ;  "        "
  102.          dc.b  'Info-text line 3',0  ;  "        "
  103.          dc.b  'Info-text line 4',0  ;  "        "
  104.          
  105.